%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/pg11.types"
    Bucket0("Bucket 0 (root)<br /><br />1: 76, 80<br />ᐳ: Access[9], Access[10], Object[11]<br />2: PgSelect[8], PgSelect[19]<br />ᐳ: Access[31], Access[77], Access[81]<br />3: Connection[12], PgSelectRows[21]<br />ᐳ: 20, 22, 23<br />4: ConnectionItems[14]<br />ᐳ: 30, 32, 33, 34"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 12, 14, 77, 81, 23, 32, 34<br /><br />ROOT Connectionᐸ8ᐳ[12]"):::bucket
    Bucket4("Bucket 4 (listItem)<br />Deps: 77, 81<br /><br />ROOT __Item{4}ᐸ14ᐳ[25]"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 26, 77<br /><br />ROOT PgSelectSingle{4}ᐸtypesᐳ[26]<br />1: <br />ᐳ: 35, 37, 38, 39, 78, 79<br />2: PgSelectRows[46]<br />ᐳ: First[45], PgSelectSingle[47]"):::bucket
    Bucket6("Bucket 6 (nullableBoundary)<br />Deps: 27, 26, 81<br /><br />ROOT Edge{4}[27]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 26, 81<br /><br />ROOT PgSelectSingle{4}ᐸtypesᐳ[26]<br />1: <br />ᐳ: 49, 51, 53, 55, 82, 83<br />2: PgSelectRows[63]<br />ᐳ: First[62], PgSelectSingle[64]"):::bucket
    Bucket8("Bucket 8 (nullableBoundary)<br />Deps: 47<br /><br />ROOT PgSelectSingle{5}ᐸfrmcdc_domainConstrainedCompoundTypeᐳ[47]"):::bucket
    Bucket9("Bucket 9 (listItem)<br /><br />ROOT __Item{9}ᐸ39ᐳ[48]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 64<br /><br />ROOT PgSelectSingle{7}ᐸfrmcdc_domainConstrainedCompoundTypeᐳ[64]"):::bucket
    Bucket11("Bucket 11 (listItem)<br /><br />ROOT __Item{11}ᐸ55ᐳ[68]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket4
    Bucket4 --> Bucket5 & Bucket6
    Bucket5 --> Bucket8 & Bucket9
    Bucket6 --> Bucket7
    Bucket7 --> Bucket10 & Bucket11

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸtypes+1ᐳ"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgSelectInlineApply76["PgSelectInlineApply[76∈0] ➊"]:::plan
    PgSelectInlineApply80["PgSelectInlineApply[80∈0] ➊"]:::plan
    Object11 & PgSelectInlineApply76 & PgSelectInlineApply80 --> PgSelect8
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    Connection12[["Connection[12∈0] ➊<br />ᐸ8ᐳ<br />Dependents: 4"]]:::plan
    PgSelect8 --> Connection12
    ConnectionItems14[["ConnectionItems[14∈0] ➊<br />Dependents: 3<br />More deps:<br />- Connection[12]"]]:::plan
    PgSelect19[["PgSelect[19∈0] ➊<br />ᐸtypes(aggregate)ᐳ"]]:::plan
    Object11 --> PgSelect19
    First20{{"First[20∈0] ➊"}}:::plan
    PgSelectRows21[["PgSelectRows[21∈0] ➊"]]:::plan
    PgSelectRows21 --> First20
    PgSelect19 --> PgSelectRows21
    PgSelectSingle22{{"PgSelectSingle[22∈0] ➊<br />ᐸtypesᐳ"}}:::plan
    First20 --> PgSelectSingle22
    First30{{"First[30∈0] ➊<br />More deps:<br />- ConnectionItems[14]"}}:::plan
    Access31{{"Access[31∈0] ➊<br />ᐸ8.cursorDetailsᐳ"}}:::plan
    PgSelect8 --> Access31
    Last33{{"Last[33∈0] ➊<br />More deps:<br />- ConnectionItems[14]"}}:::plan
    Access77{{"Access[77∈0] ➊<br />ᐸ8.m.joinDetailsFor41ᐳ"}}:::plan
    PgSelect8 --> Access77
    Access81{{"Access[81∈0] ➊<br />ᐸ8.m.joinDetailsFor58ᐳ"}}:::plan
    PgSelect8 --> Access81
    PageInfo24{{"PageInfo[24∈1] ➊<br />More deps:<br />- Connection[12]"}}:::plan
    Access28{{"Access[28∈1] ➊<br />ᐸ12.hasNextPageᐳ<br />More deps:<br />- Connection[12]"}}:::plan
    Access29{{"Access[29∈1] ➊<br />ᐸ12.hasPreviousPageᐳ<br />More deps:<br />- Connection[12]"}}:::plan
    __Item25[/"__Item[25∈4]<br />ᐸ14ᐳ<br />More deps:<br />- ConnectionItems[14]"\]:::itemplan
    PgSelectSingle26{{"PgSelectSingle[26∈4]<br />ᐸtypesᐳ"}}:::plan
    __Item25 --> PgSelectSingle26
    Edge27{{"Edge[27∈4]"}}:::plan
    __Item25 --> Edge27
    List78{{"List[78∈5]<br />ᐸ77,26ᐳ"}}:::plan
    Access77 & PgSelectSingle26 --> List78
    PgClassExpression35{{"PgClassExpression[35∈5]<br />ᐸ__types__.”id”ᐳ"}}:::plan
    PgSelectSingle26 --> PgClassExpression35
    PgClassExpression37{{"PgClassExpression[37∈5]<br />ᐸ__types__.”regrole”ᐳ"}}:::plan
    PgClassExpression35 o--o PgClassExpression37
    PgClassExpression38{{"PgClassExpression[38∈5]<br />ᐸ__types__....namespace”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression38
    PgClassExpression39{{"PgClassExpression[39∈5]<br />ᐸ__types__....ay_domain”ᐳ"}}:::plan
    PgSelectSingle26 --> PgClassExpression39
    First45{{"First[45∈5]"}}:::plan
    PgSelectRows46[["PgSelectRows[46∈5]"]]:::plan
    PgSelectRows46 --> First45
    Lambda79{{"Lambda[79∈5]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda79 --> PgSelectRows46
    PgSelectSingle47{{"PgSelectSingle[47∈5]<br />ᐸfrmcdc_domainConstrainedCompoundTypeᐳ"}}:::plan
    First45 --> PgSelectSingle47
    List78 --> Lambda79
    List82{{"List[82∈7]<br />ᐸ81,26ᐳ"}}:::plan
    Access81 & PgSelectSingle26 --> List82
    PgClassExpression49{{"PgClassExpression[49∈7]<br />ᐸ__types__.”id”ᐳ"}}:::plan
    PgClassExpression38 o--o PgClassExpression49
    PgClassExpression51{{"PgClassExpression[51∈7]<br />ᐸ__types__.”regrole”ᐳ"}}:::plan
    PgClassExpression49 o--o PgClassExpression51
    PgClassExpression53{{"PgClassExpression[53∈7]<br />ᐸ__types__....namespace”ᐳ"}}:::plan
    PgClassExpression51 o--o PgClassExpression53
    PgClassExpression55{{"PgClassExpression[55∈7]<br />ᐸ__types__....ay_domain”ᐳ"}}:::plan
    PgSelectSingle26 --> PgClassExpression55
    First62{{"First[62∈7]"}}:::plan
    PgSelectRows63[["PgSelectRows[63∈7]"]]:::plan
    PgSelectRows63 --> First62
    Lambda83{{"Lambda[83∈7]<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda83 --> PgSelectRows63
    PgSelectSingle64{{"PgSelectSingle[64∈7]<br />ᐸfrmcdc_domainConstrainedCompoundTypeᐳ"}}:::plan
    First62 --> PgSelectSingle64
    List82 --> Lambda83
    PgClassExpression50{{"PgClassExpression[50∈8]<br />ᐸ__frmcdc_d...type__.”a”ᐳ"}}:::plan
    PgSelectSingle47 --> PgClassExpression50
    PgClassExpression52{{"PgClassExpression[52∈8]<br />ᐸ__frmcdc_d...type__.”b”ᐳ"}}:::plan
    PgClassExpression50 o--o PgClassExpression52
    PgClassExpression54{{"PgClassExpression[54∈8]<br />ᐸ__frmcdc_d...type__.”c”ᐳ"}}:::plan
    PgClassExpression52 o--o PgClassExpression54
    PgClassExpression56{{"PgClassExpression[56∈8]<br />ᐸ__frmcdc_d...type__.”d”ᐳ"}}:::plan
    PgClassExpression54 o--o PgClassExpression56
    PgClassExpression65{{"PgClassExpression[65∈8]<br />ᐸ__frmcdc_d...type__.”e”ᐳ"}}:::plan
    PgClassExpression56 o--o PgClassExpression65
    PgClassExpression66{{"PgClassExpression[66∈8]<br />ᐸ__frmcdc_d...type__.”f”ᐳ"}}:::plan
    PgClassExpression65 o--o PgClassExpression66
    PgClassExpression67{{"PgClassExpression[67∈8]<br />ᐸ__frmcdc_d....”foo_bar”ᐳ"}}:::plan
    PgClassExpression66 o--o PgClassExpression67
    __Item48[/"__Item[48∈9]<br />ᐸ39ᐳ"\]:::itemplan
    PgClassExpression39 ==> __Item48
    PgClassExpression69{{"PgClassExpression[69∈10]<br />ᐸ__frmcdc_d...type__.”a”ᐳ"}}:::plan
    PgSelectSingle64 --> PgClassExpression69
    PgClassExpression70{{"PgClassExpression[70∈10]<br />ᐸ__frmcdc_d...type__.”b”ᐳ"}}:::plan
    PgClassExpression69 o--o PgClassExpression70
    PgClassExpression71{{"PgClassExpression[71∈10]<br />ᐸ__frmcdc_d...type__.”c”ᐳ"}}:::plan
    PgClassExpression70 o--o PgClassExpression71
    PgClassExpression72{{"PgClassExpression[72∈10]<br />ᐸ__frmcdc_d...type__.”d”ᐳ"}}:::plan
    PgClassExpression71 o--o PgClassExpression72
    PgClassExpression73{{"PgClassExpression[73∈10]<br />ᐸ__frmcdc_d...type__.”e”ᐳ"}}:::plan
    PgClassExpression72 o--o PgClassExpression73
    PgClassExpression74{{"PgClassExpression[74∈10]<br />ᐸ__frmcdc_d...type__.”f”ᐳ"}}:::plan
    PgClassExpression73 o--o PgClassExpression74
    PgClassExpression75{{"PgClassExpression[75∈10]<br />ᐸ__frmcdc_d....”foo_bar”ᐳ"}}:::plan
    PgClassExpression74 o--o PgClassExpression75
    __Item68[/"__Item[68∈11]<br />ᐸ55ᐳ"\]:::itemplan
    PgClassExpression55 ==> __Item68

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Connection12,ConnectionItems14,PgSelect19,First20,PgSelectRows21,PgSelectSingle22,First30,Access31,Last33,PgSelectInlineApply76,Access77,PgSelectInlineApply80,Access81 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PageInfo24,Access28,Access29 bucket1
    classDef bucket4 stroke:#0000ff
    class Bucket4,__Item25,PgSelectSingle26,Edge27 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression35,PgClassExpression37,PgClassExpression38,PgClassExpression39,First45,PgSelectRows46,PgSelectSingle47,List78,Lambda79 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,PgClassExpression49,PgClassExpression51,PgClassExpression53,PgClassExpression55,First62,PgSelectRows63,PgSelectSingle64,List82,Lambda83 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8,PgClassExpression50,PgClassExpression52,PgClassExpression54,PgClassExpression56,PgClassExpression65,PgClassExpression66,PgClassExpression67 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,__Item48 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression69,PgClassExpression70,PgClassExpression71,PgClassExpression72,PgClassExpression73,PgClassExpression74,PgClassExpression75 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,__Item68 bucket11

